/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.sys.service.customer;

import java.util.List;

import com.thinkgem.jeesite.modules.sys.dao.member.MemberDao;
import com.thinkgem.jeesite.modules.sys.entity.member.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.sys.entity.customer.Customer;
import com.thinkgem.jeesite.modules.sys.dao.customer.CustomerDao;

/**
 * customerService
 * @author jin
 * @version 2018-04-23
 */
@Service
@Transactional(readOnly = true)
public class CustomerService extends CrudService<CustomerDao, Customer> {

	@Autowired
	private CustomerDao customerDao;

	public Customer get(String id) {
		return super.get(id);
	}

	public Page<Customer> findUser(Page<Customer> page, Customer customer) {
		// 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
		customer.getSqlMap().put("dsf", dataScopeFilter(customer.getCurrentUser(), "o", "a"));
		// 设置分页参数
		customer.setPage(page);
		// 执行分页查询
		page.setList(customerDao.findList(customer));
		return page;
	}
	
	public List<Customer> findList(Customer customer) {
		return super.findList(customer);
	}
	
	public Page<Customer> findPage(Page<Customer> page, Customer customer) {
		customer.getSqlMap().put("dsf", dataScopeFilter(customer.getCurrentUser(), "o", ""));
		return super.findPage(page, customer);
	}
	
	@Transactional(readOnly = false)
	public void save(Customer customer) {
		super.save(customer);
	}
	
	@Transactional(readOnly = false)
	public void delete(Customer customer) {
		super.delete(customer);
	}

	public String checkLiId(String liId){
		return dao.checkLiId(liId);
	}

	public List<Customer> getAll(){ return dao.getAll();}

	
}